﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>结构化检索</title>
    <link rel="stylesheet" type="text/css" href="../../weblib/jquery.easyui/themes/default/easyui.css" />
	<link rel="stylesheet" type="text/css" href="../../weblib/jquery.easyui/themes/icon.css" />
	<link href="../../weblib/skins/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../weblib/jquery/jquery-1.8.0.min.js"></script>
    <script src="../../weblib/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../webjs/core/config.js" type="text/javascript"></script>
    <script src="../../weblib/jquery/jquery.adaptor.js" type="text/javascript"></script>

    <style type="text/css">
        
        body
        {
            font-size:12px;
            }
        
        #head
        {
            margin-bottom: 10px;
        }
        
        
        .s_ipt_wr
        {
            width: 380px;
            height: 30px;
            display: inline-block;
            margin-right: 5px;
            background-position: 0 -96px;
            border: 1px solid #b6b6b6;
            border-color: #7b7b7b #b6b6b6 #b6b6b6 #7b7b7b;
            vertical-align: top;
        }
        
        .s_ipt
        {
            width: 370px;
            height: 22px;
            font: 16px/22px arial;
            margin: 5px 0 0 7px;
            padding: 0;
            background: #fff;
            border: 0;
            outline: 0;
            -webkit-appearance: none;
        }
        
        .bg
        {
            background-image: url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_4879d3b8.png);
            background-repeat: no-repeat;
            _background-image: url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_5a07887b.gif);
            background-repeat: no-repeat;
        }
        
        .s_btn
        {
            width: 95px;
            height: 32px;
            padding-top: 2px;
            font-size: 14px;
            padding: 0;
            background-color: #ddd;
            background-position: 0 -48px;
            border: 0;
            cursor: pointer;
        }
        
        .s_btn_wr
        {
            width: 97px;
            height: 34px;
            display: inline-block;
            background-position: -120px -48px;
            z-index: 0;
            vertical-align: top;
        }
        
        .t
        {
            font-weight: normal;
            font-size: medium;
            margin-bottom: 1px;
        }
        
        a:-webkit-any-link
        {
            color: -webkit-link;
            text-decoration: underline;
            cursor: auto;
        }
        
        .ec_desc
        {
            line-height: 19px;
        }
        
        .ec_font_small
        {
            font-size: small;
        }
        
        .ec_meta
        {
            margin-top: 1px;
            line-height: 18px;
        }
        
        .ec_date, .ec_url
        {
            color: green;
        }
        
        h3
        {
            display: block;
            margin: 0;
            padding: 0;
            list-style: none;
        }
        
        a
        {
            color: Blue;
            text-decoration: underline;
        }
        a:hover
        {
            color: #004988;
            text-decoration: underline;
            cursor: pointer;
        }
        .menulist
        {
            padding: 0px 10px;
            border: 1px solid #ccc;
            line-height: 28px;
            height: 26px;
            background: #f7f7f7;
        }
        
        #commendcontainer
        {
            padding: 10px;
            margin: 15px 0;
            border: 1px solid #4c95c7;
            height: 60px;
            display: none;
        }
        .search_header
        {
            height: 30px;
        }
        .search_header_left
        {
            float: left;
            width: 240px;
        }
        .search_header_right
        {
            margin-left: 250px;
            padding-right: 15px;
            line-height: 28px;
        }
        ul.search_tab_li
        {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        ul.search_tab_li li
        {
            cursor: pointer;
            float: left;
            width: 110px;
            border: 1px solid #4c95c7;
            border-bottom: none;
            text-align: center;
            background: #dbe5ee;
            line-height: 29px;
            height: 29px;
        }
        ul.search_tab_li li.current
        {
            background: #f9fcfe;
        }
        .search_list
        {
            min-height:80px;
            padding: 10px;
            border: 1px solid #4c95c7;
        }
        
        .sarch_logo
        {
            background: url(../../weblib/skins/images/search_logo.gif) no-repeat;
            width: 36px;
            height: 35px;
            float: left;
            padding-right: 10px;
        }
        .search_input
        {
            float: left;
            position: relative;
        }
      #menu_list .panel-body .accordion-body{border-bottom:0px;}
    </style>

    <script type="text/javascript">
        $(function () {

            function getsubmenu(data, parent_menuid, _html) {
                if (data.detail && data.detail.length > 0) {
                    for (var i = 0; i < data.detail.length; i++) {
                        if (data.detail[i].T_CAT == parent_menuid) {
                            _html.push('<div class="submenu" id="' + data.detail[i].T_ENG_NAME + '" proc="'
                            + data.detail[i].T_PROC_NAME + '" _title="' + data.detail[i].T_CN_NAME + '" >'
                            + data.detail[i].T_CN_NAME + '(' + data.detail[i].CNT + ')</div>');
                        }
                    }
                }
                return _html;
            }

            //点击搜索按钮
            $("#btnSearch").click(function () {

                if ($.trim($("#txtKeyword").val()) == "") {
                    return;
                }

                $.post("../../Handlers/StructTableDictHandler.ashx?optype=keywsearch",
                {
                    keyw: $.trim($("#txtKeyword").val())
                },
                function (data) {
                    if (data && data.success) {
                        var _html = [];
                        if (data.cat.length == 0) return;
                        for (var i = 0; i < data.cat.length; i++) {

                            _html.push('<div title="' + data.cat[i].t_cat + '(' + data.cat[i].cnt + ')"  style="padding:10px">');
                            var _subhtml = [];
                            getsubmenu(data, data.cat[i].t_cat, _subhtml);
                            _html.push(_subhtml.join('') + '</div>');
                        }

                        $('#menu_list_warp').html('<div id="menu_list" ></div>');
                        $('#menu_list').html(_html.join(''));

                        $('#menu_list').accordion({ animate: false, border: false });
                        $('#menu_list .panel-body .accordion-body').css({ border: 0 });
                        $('.accordion-noborder .accordion-body').css({ border: 0 });

                        $('#menu_list div[proc]:eq(0)').click();
                    }
                });
            });

            $("#menu_list div[proc]").live('click', function () {
                var tabEngName = $(this).attr("id").toString();
                var tableCNName = $(this).attr("title");
                var procName = $(this).attr("proc");
                var keywText = $("#txtKeyword").val();

                $.post("../../Handlers/StructTableDictHandler.ashx?optype=getdict",
                {
                    tab_code: tabEngName
                },
                function (data) {

                    var cols = [];
                    for (var i = 0; i < data.length; i++) {
                        cols.push({
                            field: data[i].Col_Eng_Name.toUpperCase(),
                            title: data[i].Col_CN_Name,
                            width: data[i].Col_Width,
                            align: data[i].Col_Align
                        });
                    }

                    var icols = [];
                    icols.push(cols);

                    $('#dgTable').datagrid({
                        url: '../../Handlers/StructTableDictHandler.ashx?optype=querydata',
                        columns: icols,
                        method: "post",
                        queryParams:
                        {
                            proc: procName,
                            kw: keywText
                        },
                        rownumbers: true,
                        animate: true,
                        collapsible: true,
                        pageSize: 10,
                        pagination: true,
                        singleSelect: true
                    });

                    //设置分页控件  
                    var p = $('#dgTable').datagrid('getPager');
                    $(p).pagination({
                        pageSize: 10, //每页显示的记录条数，默认为10  
                        pageList: [10, 15, 20], //可以设置每页记录条数的列表  
                        beforePageText: '第', //页数文本框前显示的汉字  
                        afterPageText: '页    共 {pages} 页',
                        displayMsg: ''
                        /*displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
                        */
                    });
                });
            });
        });
    </script>

</head>
<body>
    <div style=" margin:10px auto; width:90%; ">
        <div id="head">
            <div style="text-align: left; width: 740px;">
                <div style="width: 740px; height: 38px; margin: 30px 0 20px;">
                    <div class="sarch_logo">
                    </div>
                    <div class="search_input">
                        <span class="s_ipt_wr">
                            <input type="text" class="s_ipt" ID="txtKeyword" />
                        </span><span class="bg s_btn_wr">
                            <input type="button" id="btnSearch" class="bg s_btn" value="搜索一下" />
                        </span>
                        
                    </div>
                </div>
            </div>
            <div style="clear: both; height: 1px;">
            </div>
        </div>

        <div class="searchtab">
            <div class="search_list">
                <div style="width:240px;float:left;" >
                <div id="menu_list_warp">
                    <div id="menu_list" ></div>
                </div>
                    <div style="clear:both;height:1px;"></div>
                </div>
                <div style=" margin-left:250px; padding-right:15px;">
                    <table id="dgTable"></table>
                </div>
                <div style="clear:both;height:1px;"></div>
            </div>
        </div>
    </div>
</body>
</html>
